home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 28
/
Aminet 28 (1998)(GTI - Schatztruhe)[!][Dec 1998].iso
/
Aminet
/
dev
/
c
/
AMesaRTL.lha
/
Mesa-2.6
/
amiga
/
drivers
/
mesadriver.doc
Wrap
Text File
|
1998-09-19
|
22KB
|
629 lines
TABLE OF CONTENTS
mesadriver/--background--
mesadriver/AmigaMesaRTLCreateContextA
mesadriver/AmigaMesaRTLDestroyContext
mesadriver/AmigaMesaRTLMakeCurrent
mesadriver/AmigaMesaRTLGetCurrentContext
mesadriver/AmigaMesaRTLSetIndexRGBTable
mesadriver/AmigaMesaRTLSetIndexRGB
mesadriver/AmigaMesaRTLGetIndexRGB
mesadriver/AmigaMesaRTLSetContextAttrsA
mesadriver/AmigaMesaRTLGetContextAttr
mesadriver/AmigaMesaRTLSetOutputHandlerAttrsA
mesadriver/AmigaMesaRTLGetOutputHandlerAttr
mesadriver/AmigaMesaRTLSetAttrsA
mesadriver/AmigaMesaRTLGetAttr
mesadriver/--background-- mesadriver/--background--
NAME
mesadriver - Driver interface to AmigaMesaRTL
PURPOSE
This document describes the Amiga-specific interface to the Mesa
library.
The driver is what makes Mesa work on a specific platform. It
provides the low-level operations, such as drawing a pixel, which
the main Mesa library eventually calls to produce output. These
functions are for use by the Mesa library alone, and so are not
publicly accessible.
The driver also provides the platform-specific routines needed to set
up and manage a context. These functions are publicly accessible of
course, and are described here.
Mesa has two modes: Index mode and RGBA mode. In Index mode, the
buffer contains one byte per pixel. Each byte is an index into a
palette table describing the colour of that pixel.
In RGBA mode, the buffer contains four bytes per pixel, describing
the truecolour colour of the pixel. The order of the bytes in the
buffer is of no concern to the user, only to the driver and output
handler. The output handler can tell the driver what order to use by
implementing the OH_RGBAOrder tag (see the outputhandler doc). The
AmigaMesaRTL driver understands both RGBA (A in lowbyte) and ARGB (A
in highbyte) order, and defaults to RGBA.
WRITING YOUR OWN DRIVER
Any driver should at least present the interface described here. A
driver need not support output handlers.
The Mesa library makes heavy use of function pointers. This presents
a problem, as functions in an Amiga run-time library expect a pointer
to the library base in register A6, which is not set up when the
function is called through a function pointer. This alone is not
disasterous. But the global data pointer A4 is determined based on
the value of A6 if the library is linked with libinitr.o. Fortunately
very few functions are likely to need access to the global data
section. In the case of the AmigaMesaRTL driver, only get_buffer_size
and renderer_string need to. In the former case, A4 is manually set
to a value stored in the context. In the latter case, the constant
string is actually put in the far data section, which is shared by
all instances of the library.
mesadriver/AmigaMesaRTLCreateContextA mesadriver/AmigaMesaRTLCreateContextA
NAME
AmigaMesaRTLCreateContextA - Create a new context
AmigaMesaRTLCreateContext - Varargs stub
SYNOPSIS
result = AmigaMesaRTLCreateContextA(tags)
D0 A0
AmigaMesaRTLContext AmigaMesaRTLCreateContextA(struct TagItem *);
result = AmigaMesaRTLCreateContext(tag1, ...)
AmigaMesaRTLContext AmigaMesaRTLCreateContext(ULONG, ...);
FUNCTION
A new Mesa rendering context is created and initialized. If requested
an output handler is also opened and initialized. Don't assume that
the context will be current after creation.
INPUTS
tags - Pointer to a tag list
TAGS
AMRTL_RGBAMode (BOOL) - Use RGBA mode. (Default TRUE)
AMRTL_IndexMode (BOOL) - Use Index mode. (Default FALSE)
AMRTL_OutputHandler (STRPTR) - Name of output handler to use. If the
tag value is NULL, no output handler is opened unless the tag
AMRTL_OutputHandlerBase is also used.
AMRTL_OutputHandlerVersion (ULONG) - Lowest version number to request
when opening an output handler. The default is given by the
environment variable "AmigaMesaRTL/OutputHandlerVersion", or 2
if that does not exist either.
AMRTL_OutputHandlerBase (struct Library *) - Use the given output
handler library base instead of opening a new one. If the tag
value is NULL, no output handler will be opened.
If neither AMRTL_OutputHandler nor AMRTL_OutputHandlerBase are
given, environment variables are used to determine which handler
to open. If an output type is specified (OH_OutputType) in the
tag list, the output handler named in the environment variable
"AmigaMesaRTL/<output type>" is used. If variable can not be
used, the default handler named in the environment variable
"AmigaMesaRTL/OutputHandler" is used. If this doesn't exist
either, the dl1 output handler is used.
AMRTL_Mode (ULONG) - What mode to use. Currently only AMRTL_RGBAMode
and AMRTL_IndexMode are valid valued for this tag. (Default
AMRTL_RGBAMode).
AMRTL_OutputWidth (GLint)
AMRTL_OutputHeight (GLint) - Initial requested size of the output
buffer. This value may be overridden by the output handler, and
modified by the driver. (Defaults 8).
AMRTL_GL (STRPTR) - Name of the main mesa library to use. The driver
must know which mesa library to use. Both the program using the
driver and the driver itself must use the same Mesa library
base, so if you specify this tag, your program must get the
value of the AMRTL_GLBase tag and use it as the mesamainBase.
At present the mesa base can be and must be set only once for a
given mesadriverBase. If you link with Mesa.LIB, this will be
done by the autoinitialization function, so this tag will be
ignored. Note that it is a Bad Idea to share the same mesa main
base with other mesa driver bases.
AMRTL_GLBase (struct Library *) - Similar to AMRTL_GL, except you
pass an already-opened mesamainBase pointer.
OH_#? - If an output handler is used, it will be initialized with a
copy of the tag list used to create the context. You can
therefore also specify output handler tags here for output
handler initialization. The driver will set OH_DriverBase.
RESULTS
result - An abstract AmigaMesaRTLContext pointer, or NULL if an error
occured during initialization.
BUGS
None
SEE ALSO
AmigaMesaRTLDestroyContext()
mesadriver/AmigaMesaRTLDestroyContext mesadriver/AmigaMesaRTLDestroyContext
NAME
AmigaMesaRTLDestroyContext - Delete a context
SYNOPSIS
AmigaMesaRTLDestroyContext(context)
A0
void AmigaMesaRTLDestroyContext(AmigaMesaRTLContext);
FUNCTION
The given context is deleted. If an output handler is associated with
the context, it too is deleted. If the driver opened the handler, the
handler is closed as well.
INPUTS
context - Context to delete
RESULTS
None
BUGS
None
SEE ALSO
mesadriver/AmigaMesaRTLMakeCurrent mesadriver/AmigaMesaRTLMakeCurrent
NAME
AmigaMesaRTLMakeCurrent - Make a context current
SYNOPSIS
AmigaMesaRTLMakeCurrent(context)
A0
void AmigaMesaRTLMakeCurrent(AmigaMesaRTLContext);
FUNCTION
The given context is made current. A context must be made current if
you want to do anything with it. Failure to do so will cause very
strange things to happen.
INPUTS
context - Context to make current
RESULTS
None
BUGS